#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int removeDuplicates(int* nums, int numsSize) {
    if (numsSize == 0) return 0;
    int index = 1;
    for (int i = 1; i < numsSize; i++) {
        printf("index = %d, num[i]=%d, nums[index]=%d\n", index, nums[i], nums[index]);
        if (nums[i] > nums[i - 1]) {
            nums[index++] = nums[i];
        }
    }
    return index;
}

int removeDuplicates1(int* nums, int numsSize) {
    if (numsSize == 0) return 0;
    int index = 0;
    for (int i = 1; i < numsSize; i++) {
        if (nums[i] > nums[index]) {
            nums[++index] = nums[i];
        }
    }
    return ++index;
}

int main() {
    int nums[] = { 1, 1, 2, 2 };
    int res = removeDuplicates1(nums, sizeof(nums) / sizeof(int));
    printf("res = %d\n", res);
    for (int i = 0; i < res; i++) {
        printf("i = %d\n", nums[i]);
    }
    return 0;
}